#pragma once
// 供用户编辑的
#include <iostream>
#include <functional>

using namespace std;
namespace Task
{
    int MyMath(int a, int b, char op)
    {
        int results = -1;
        switch (op)
        {
        case '+':
            results = a + b;
            break;
        case '-':
            results = a - b;
            break;
        case '*':
            results = a * b;
            break;
        case '/':
            if (b == 0)
            {
                cout << "被除数不能为0" << endl;
                break;
            }
            results = a / b;
            break;
        case '%':
            results = a % b;
            break;
        }
        return results;
    }

    typedef function<int(int, int, char)> func_t;
    class Task
    {
    public:
        Task(int a = 0, int b = 0, char op = 0, func_t func = MyMath)
            : func_(func), op_(op), a_(a), b_(b)
        {
        }

        ~Task()
        {
        }

        int operator()()
        {
            return func_(a_, b_, op_);
        }

        int Return_a()
        {
            return a_;
        }

        int Return_b()
        {
            return b_;
        }

        int Return_op()
        {
            return op_;
        }

    private:
        int a_;
        int b_;
        char op_;
        func_t func_;
    };
}